package com.yusp75.myexam.ui.help

import android.annotation.SuppressLint
import androidx.fragment.app.viewModels
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.webkit.WebViewClient
import com.yusp75.myexam.databinding.FragmentHelpBinding

class HelpFragment : Fragment() {

    private val viewModel: HelpViewModel by viewModels()
    private var _binding: FragmentHelpBinding? = null
    private val binding get() = _binding!!


    @SuppressLint("SetJavaScriptEnabled")
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        _binding = FragmentHelpBinding.inflate(inflater, container, false)
        val root: View = binding.root

        // 显示help.html
        _binding?.apply {
            webView.settings.apply {
                javaScriptEnabled = true
                domStorageEnabled = true
            }
            webView.webViewClient = WebViewClient()
            webView.loadUrl("file:///android_asset/help.html")
        }


        //
        return root
    }
}